package com.itheima.mapper.client;

import com.itheima.client.shoppingcartpojo.dto.ShoppingCartAddDto;
import com.itheima.client.shoppingcartpojo.vo.ShoppingCartAddVo;
import com.itheima.client.shoppingcartpojo.vo.ShoppingCartListVo;
import com.itheima.client.shoppingcartpojo.vo.ShoppingCartdeleteVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author wuzhiyong
 */
@Mapper
public interface ShoppingCartMapper {

    /**
     * 加入购物车
     *
     * @param shoppingCartAddDto shoppingCartAddDto
     * @return 条数
     */
    int insertShoppingCart(ShoppingCartAddDto shoppingCartAddDto);

    /**
     * 加入购物车-通过菜品id查询购物车
     *
     * @param dishId dishId
     * @param userId userId
     * @return ShoppingCartAddVo
     */
    ShoppingCartAddVo selectShoppingCartByDishId(String dishId, String userId);

    /**
     * 加入购物车-通过套餐id查询购物车
     *
     * @param setmealId setmealId
     * @param userId    userId
     * @return ShoppingCartAddVo
     */
    ShoppingCartAddVo selectShoppingCartBySetmealId(String setmealId, String userId);

    /**
     * 加入购物车-更新菜品份数
     *
     * @param number number
     * @param dishId dishId
     * @param userId userId
     * @return 条数
     */
    int updateShoppingCartNumberByDishId(Integer number, String dishId, String userId);

    /**
     * 加入购物车-更新套餐份数
     *
     * @param number    number
     * @param setmealId setmealId
     * @param userId    userId
     * @return 条数
     */
    int updateShoppingCartNumberBySetmealId(Integer number, String setmealId, String userId);


    /**
     * 购物车列表
     *
     * @param userId userId
     * @return List<ShoppingCartListVo>
     */
    List<ShoppingCartListVo> selectShoppingCart(String userId);

    /**
     * 清空购物车
     *
     * @param userId userId
     * @return 条数
     */
    int deleteShoppingCart(String userId);

    /**
     * 删除购物车商品-通过菜品Id
     *
     * @param dishId dishId
     * @return 条数
     */
    int deleteShoppingCartByDishId(String dishId);

    /**
     * 删除购物车商品-通过套餐Id
     *
     * @param setmealId setmealId
     * @return 条数
     */
    int deleteShoppingCartBySetmealId(String setmealId);

    /**
     * 删除购物车商品-通过用户id查询购物车信息
     *
     * @param userId userId
     * @return List<ShoppingCartdeleteVo>
     */
    List<ShoppingCartdeleteVo> selectShoppingCartByUserId(String userId);


}

